possible fix for JENKINS-76200 #1152
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
[JENKINS-76200] Start stopped instances in attemptReconnectIfOffline + extensive debug logging
This commit adds both a fix and extensive debug logging to diagnose and resolve
JENKINS-76200 where existing offline Jenkins nodes with stopped EC2 instances
are never restarted, causing jobs to wait indefinitely.
Root Cause Analysis:
When an existing Jenkins node is offline with a stopped EC2 instance, Jenkins
does NOT call start() on the retention strategy. Instead, it periodically calls
check() which calls attemptReconnectIfOffline(). The original implementation
only attempted reconnection for RUNNING instances, leaving stopped instances
in limbo forever.
Changes Made:
Added extensive debug logging throughout EC2RetentionStrategy:
all decision branches, AWS API calls, and any errors
All debug logs are tagged with [JENKINS-76200] for easy filtering.
Modified attemptReconnectIfOffline() to start stopped instances:
Added necessary imports:
Testing Instructions:
Deploy this build to Jenkins with an offline node that has a stopped instance
Trigger a job that requires the offline node
Check Jenkins logs for [JENKINS-76200] messages showing:
Verify in AWS console that the instance actually starts
Expected Behavior: